package com.power.sifa.runner;

import com.power.sifa.runner.jobs.WarningThread;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

/**
 * 异步处理队列信息
 * 包括微信通知、文件生成、更新企业信息等等
 *
 * @author wangn
 */
@Component
@Order(10)
@Slf4j
public class AnsycJobsRunner implements ApplicationRunner {
    /**
     * 是否启用
     */
    @Value("${power.ansyc-job:#{false}}")
    private Boolean enable;

    @Override
    public void run(ApplicationArguments args) {
        if (enable) {
            // 告警信息队列
			new Thread(WarningThread.getInstance()).start();
			log.info("启动告警任务执行队列");
        }
    }
}
